import Vue from "vue"; //引入Vue
import VueRouter from "vue-router"; //引入vue-router
Vue.use(VueRouter); //Vue全局使用Router

const routes = [
  {
    path: "/",
    name: "Main",
    component: () => import("../views/Main.vue"),
    redirect: "/home",
    children: [
      {
        path: "/home",
        name: "home",
        component: () => import("../views/Home.vue"), // 首页
      },
      {
        path: "/user",
        name: "user",
        component: () => import("../views/User.vue"), // 用户管理
      },
      {
        path: "/mall",
        name: "mall",
        component: () => import("../views/Mall.vue"), // 商品管理
      },
      {
        path: "/page1",
        name: "page1",
        component: () => import("../views/other/PageOne.vue"),
      },
      {
        path: "/page2",
        name: "page2",
        component: () => import("../views/other/PageTwo.vue"),
      },
      {
        path: "/snake",
        name: "snake",
        component: () => import("../views/other/snake/Snake.vue"),
      },
      {
        path: "/music",
        name: "music",
        component: () => import("../views/other/Music.vue"),
      },
    ],
  },
  {
    path: "/login",
    name: "login",
    component: () => import("../views/Login.vue"),
  },
  // {
  //   path: "/live2d",
  //   component: () => import("../views/live2d/index.html"),
  // },
];

const router = new VueRouter({
  mode: "history",
  routes,
});

export default router;
